package com.xcdh.base.controller;
import com.xcdh.base.service.IconService;
import com.xcdh.commons.controller.BaseController;
import com.xcdh.domain.entity.IconDO;
import com.xcdh.domain.vo.IconVo;
import com.xcdh.domain.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/icon")
public class IconController extends BaseController<IconDO,IconService>{

    @Autowired
    private IconService iconService ;

    @PostMapping("/findIconGroup")
    public R<List<IconVo>> findIconGroup(){
        List<IconDO> iconDOS = iconService.groupIcon();
        List<IconVo> iconVoList = iconDOS.stream().map(icon -> {
            return new IconVo(icon.getTypeName());
        }).collect(Collectors.toList());
        return R.okData(iconVoList) ;
    }

}
